package com.eastcom.groovy.process

import com.eastcom.groovy.task.TaskManager
import com.eastcom.groovy.tools.common.ShellExecutor;
import com.eastcom.groovy.tools.db.DbEngine;
import com.eastcom.groovy.tools.file.FileUtils;

import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory
import org.codehaus.groovy.tools.shell.Shell
import org.springframework.beans.factory.annotation.Value
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
import org.springframework.stereotype.Component

import javax.annotation.Resource

/**
 * Created by yuanyue on 2014-08-03.
 */
@Component("taskInitProcess")
class TaskInitProcess {
    private static Log logger = LogFactory.getLog(TaskInitProcess.class)
    @Resource(name = "threadPool")
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
    @Resource(name = "dbEngine")
    private DbEngine dbEngine;
    @Resource(name = "groovyTaskManager")
    private TaskManager taskManager;
    /**
     *
     */
    public void init(final List<String> taskConfigPath){
        threadPoolTaskExecutor.execute(new Runnable() {
            @Override
            public void run() {
                taskManager.loadTask(taskConfigPath);
            }
        });
    }
}

